import service from "../utils/request";
import {queryKey} from '../utils'


// 列表
export function getNetworkList(params:any,type:string) {
  const other = queryKey()
  return service.get(`/network${type === 'network-vpc' ?'':'-subnets'}`, { params:{...params, ...other} });
}
// 改
export function createNetwork(data:any,type:string) {
  return service.post(`/network${type === 'network-vpc' ?'':'-subnets'}`,data);
}
// 删除
export function deleteNetwork(type:string,data:any) {
  return service.delete(`/network${type === 'network-vpc' ?'':'-subnets'}`,{data});
}
// 改
export function editSubnet(id:number,data:any) {
  return service.put(`/network-subnets'}/${id}`,data);
}
// 同步网络
export function syncNetwork(type:string) {
  return service.post(`/network${type === 'network-vpc' ?'':'-subnets'}/sync`);
}
//查询树-平台&集群
export function getPlatformTreeList() {
  return service.get(`/platform/tree`);
}
//查询交换机
export function getVdsList(id:number) {
  return service.get(`/platform/${id}/vds-resource`);
}

//外部网络
export function getExtNetworksList(id:number,params:any) {
  return service.get(`/platform/${id}/external-networks`,{params});
}